using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using FairyGUI;

namespace ABA
{
    public class SysText : Singleton<SysText>
    {
        Dictionary<string, string> _dic = new Dictionary<string, string>();
        public string GetText(string name, string compName = "sys_text")
        {
            if(compName == "") compName = name;

            GComponent cp = null;
            if(_dic.ContainsKey(name))  return _dic[name];
            else {
                cp = UIPackage.CreateObject("sys", compName).asCom;

                var t = cp.GetChild(name);
                if(t == null) return "";

                string str = t.asTextField.text;

                _dic.Add(name, str);
                
                return str;                
            }
        }
    }
}
